package server

import (
	"data_service/models"
)

// MessageService 提供消息相关业务逻辑
// 供 handler 层调用，解耦 handler 与 models
// 只负责业务流程，不直接操作数据库

type MessageService struct{}

func NewMessageService() *MessageService {
	return &MessageService{}
}

// CreateMessage 创建消息
func (s *MessageService) CreateMessage(msg *models.Message) error {
	return models.CreateMessage(msg)
}

// GetMessagesByRoom 获取房间消息历史
func (s *MessageService) GetMessagesByRoom(roomID uint, limit int) ([]models.Message, error) {
	return models.GetMessagesByRoom(roomID, limit)
}
